﻿using Core;
using ProtoBuf;
using System.Collections.Generic;

namespace Message
{
    [ProtoContract]
    [MessageData(1)]
    public class TickOutside : IPushMessage
    {

    }

    [ProtoContract]
    [MessageData(2)]
    public class LoginRequest : IRequestMessage
    {
        [ProtoMember(1)]
        public string account { get; set; }

        [ProtoMember(2)]
        public string password { get; set; }
    }

    [ProtoContract]
    [MessageData(3)]
    public class LoginResponse : IResponseMessage
    {
        [ProtoMember(1)]
        public ushort error { get; set; }

        [ProtoMember(2)]
        public uint userID { get; set; }
    }

    [ProtoContract]
    [MessageData(4)]
    public class ServerListRequest : IRequestMessage
    {

    }

    [ProtoContract]
    [MessageData(5)]
    public class ServerListResponse : IResponseMessage
    {
        [ProtoMember(1)]
        public ushort error { get; set; }

        [ProtoMember(2)]
        public List<uint> serverList { get; set; }
    }

    [ProtoContract]
    [MessageData(6)]
    public class ConnectServerRequest : IRequestMessage
    {
        [ProtoMember(1)]
        public uint serverID { get; set; }
    }

    [ProtoContract]
    [MessageData(7)]
    public class ConnectServerResponse : IResponseMessage
    {
        [ProtoMember(1)]
        public ushort error { get; set; }
    }

    [ProtoContract]
    [MessageData(8)]
    public class RoleInfoRequest : IRequestMessage
    {

    }

    [ProtoContract]
    public class RoleInfo
    {
        [ProtoMember(1)]
        public int roleID;
        [ProtoMember(2)]
        public int level;
        [ProtoMember(3)]
        public string name;
    }

    [ProtoContract]
    [MessageData(9)]
    public class RoleInfoResponse : IResponseMessage
    {
        [ProtoMember(1)]
        public ushort error { get; set; }
        [ProtoMember(2)]
        public RoleInfo roleData { get; set; }
    }


    [ProtoContract]
    [MessageData(10)]
    public class ForceDisconnectPush : IPushMessage
    {
        [ProtoMember(1)]
        public int code { get; set; }
    }

    public enum ForceDisconnectType
    {
        None,
        ExistSession,
    }

    // 客户端准备
    [ProtoContract]
    [MessageData(11)]
    public class BattleReadyRequest : IRequestMessage
    {
        [ProtoMember(1)]
        public uint userId { get; set; }
    }

    // 响应准备消息，可以并告诉一些其他信息
    [ProtoContract]
    [MessageData(12)]
    public class BattleReadyResponse : IResponseMessage
    {
        [ProtoMember(1)]
        public ushort error { get; set; }
    }

    // 所有玩家准备完毕，战斗开始
    [ProtoContract]
    [MessageData(13)]
    public class BattleStartPush : IPushMessage
    {
        [ProtoMember(1)]
        public int playerCount { get; set; }
        [ProtoMember(2)]
        public List<int> playerIds { get; set; }
    }

    // 战斗指令
    [ProtoContract]
    [MessageData(14)]
    public class BattleCommandPlayerPush : IPushMessage
    {
        [ProtoMember(1)]
        public int tick { get; set; }
        [ProtoMember(2)]
        public byte[] data { get; set; }
    }

    // 玩家请求响应
    [ProtoContract]
    [MessageData(15)]
    public class BattleCommandPlayerPushTime : IPushMessage
    {
        [ProtoMember(1)]
        public int tick { get; set; }
        [ProtoMember(2)]
        public int serverFrameIndex { get; set; }
        [ProtoMember(3)]
        public int currentSumTime { get; set; }
    }

    // 战斗指令
    [ProtoContract]
    [MessageData(16)]
    public class BattleCommandServerPush : IPushMessage
    {
        [ProtoMember(1)]
        public int tick { get; set; }
        [ProtoMember(2)]
        public List<byte[]> datas { get; set; }
    }
}